<?php
/* 	These code was generated using phpCIGen v 0.1.b (24/06/2009)
	#zaqi 		zaqi.smart@gmail.com,http://zenzaqi.blogspot.com, 
	#CV. Trust Solution, jl. Saronojiwo 19 Surabaya, http://www.ts.co.id
	
	+ Module  		: s_info View
	+ Description	: For record view
	+ Filename 		: v_s_info.php
 	+ Author  		: 
 	+ Created on 27/Jan/2010 11:25:10
	
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<style type="text/css">
        p { width:650px; }
		.search-item {
			font:normal 11px tahoma, arial, helvetica, sans-serif;
			padding:3px 10px 3px 10px;
			border:1px solid #fff;
			border-bottom:1px solid #eeeeee;
			white-space:normal;
			color:#555;
		}
		.search-item h3 {
			display:block;
			font:inherit;
			font-weight:bold;
			color:#222;
		}
		
		.search-item h3 span {
			float: right;
			font-weight:normal;
			margin:0 0 5px 5px;
			width:100px;
			display:block;
			clear:none;
		}
    </style>
<script>
/* declare function */		
var s_info_DataStore;
var s_info_ColumnModel;
var s_infoListEditorGrid;
var s_info_saveForm;
var s_info_saveWindow;
var s_info_searchForm;
var s_info_searchWindow;
var s_info_SelectedRow;
var s_info_ContextMenu;

//declare konstant
var post2db = '';
var msg = '';
var pageS=15;

/* declare variable here for Field*/
var info_idField;
var info_namaField;
var info_alamatField;
var info_notelpField;
var info_nofaxField;
var info_emailField;
var info_websiteField;
var info_sloganField;
var info_logoField;
var info_iconField;
var info_backgroundField;
var info_themeField;
var info_idSearchField;
var info_namaSearchField;
var info_alamatSearchField;
var info_notelpSearchField;
var info_nofaxSearchField;
var info_emailSearchField;
var info_websiteSearchField;
var info_sloganSearchField;
var info_logoSearchField;
var info_iconSearchField;
var info_backgroundSearchField;
var info_themeSearchField;

/* on ready fuction */
Ext.onReady(function(){
  	Ext.QuickTips.init();	/* Initiate quick tips icon */
  
  	/* Function for Saving inLine Editing */
	function s_info_inline_update(oGrid_event){
		var info_id_update_pk="";
		var info_nama_update=null;
		var info_alamat_update=null;
		var info_notelp_update=null;
		var info_nofax_update=null;
		var info_email_update=null;
		var info_website_update=null;
		var info_slogan_update=null;
		var info_logo_update=null;
		var info_icon_update=null;
		var info_background_update=null;
		var info_theme_update=null;

		info_id_update_pk = oGrid_event.record.data.info_id;
		if(oGrid_event.record.data.info_nama!== null){info_nama_update = oGrid_event.record.data.info_nama;}
		if(oGrid_event.record.data.info_alamat!== null){info_alamat_update = oGrid_event.record.data.info_alamat;}
		if(oGrid_event.record.data.info_notelp!== null){info_notelp_update = oGrid_event.record.data.info_notelp;}
		if(oGrid_event.record.data.info_nofax!== null){info_nofax_update = oGrid_event.record.data.info_nofax;}
		if(oGrid_event.record.data.info_email!== null){info_email_update = oGrid_event.record.data.info_email;}
		if(oGrid_event.record.data.info_website!== null){info_website_update = oGrid_event.record.data.info_website;}
		if(oGrid_event.record.data.info_slogan!== null){info_slogan_update = oGrid_event.record.data.info_slogan;}
		if(oGrid_event.record.data.info_logo!== null){info_logo_update = oGrid_event.record.data.info_logo;}
		if(oGrid_event.record.data.info_icon!== null){info_icon_update = oGrid_event.record.data.info_icon;}
		if(oGrid_event.record.data.info_background!== null){info_background_update = oGrid_event.record.data.info_background;}
		if(oGrid_event.record.data.info_theme!== null){info_theme_update = oGrid_event.record.data.info_theme;}

		Ext.Ajax.request({  
			waitMsg: 'Please wait...',
			url: 'index.php?c=c_s_info&m=get_action',
			params: {
				info_id	: info_id_update_pk, 
				info_nama	:info_nama_update,
				info_alamat	:info_alamat_update,
				info_notelp	:info_notelp_update,
				info_nofax	:info_nofax_update,
				info_email	:info_email_update,
				info_website	:info_website_update,
				info_slogan	:info_slogan_update,
				info_logo	:info_logo_update,
				info_icon	:info_icon_update,
				info_background	:info_background_update,
				info_theme	:info_theme_update,
				task: "UPDATE"
			}, 
			success: function(response){							
				var result=eval(response.responseText);
				switch(result){
					case 1:
						s_info_DataStore.commitChanges();
						s_info_DataStore.reload();
						break;
					default:
						Ext.MessageBox.show({
						   title: 'Warning',
						   msg: 'We could\'t not save the S Info.',
						   buttons: Ext.MessageBox.OK,
						   animEl: 'save',
						   icon: Ext.MessageBox.WARNING
						});
						break;
				}
			},
			failure: function(response){
				var result=response.responseText;
				Ext.MessageBox.show({
				   title: 'Error',
				   msg: 'Koneksi database gagal.',
				   buttons: Ext.MessageBox.OK,
				   animEl: 'database',
				   icon: Ext.MessageBox.ERROR
				});	
			}									    
		});   
	}
  	/* End of Function */
  
  	/* Function for add and edit data form, open window form */
	function s_info_save(){
	
		if(is_s_info_form_valid()){	
			var info_id_field_pk=null; 
			var info_nama_field=null; 
			var info_alamat_field=null; 
			var info_notelp_field=null; 
			var info_nofax_field=null; 
			var info_email_field=null; 
			var info_website_field=null; 
			var info_slogan_field=null; 
			var info_logo_field=null; 
			var info_icon_field=null; 
			var info_background_field=null; 
			var info_theme_field=null; 

			info_id_field_pk=get_pk_id();
			if(info_namaField.getValue()!== null){info_nama_field = info_namaField.getValue();} 
			if(info_alamatField.getValue()!== null){info_alamat_field = info_alamatField.getValue();} 
			if(info_notelpField.getValue()!== null){info_notelp_field = info_notelpField.getValue();} 
			if(info_nofaxField.getValue()!== null){info_nofax_field = info_nofaxField.getValue();} 
			if(info_emailField.getValue()!== null){info_email_field = info_emailField.getValue();} 
			if(info_websiteField.getValue()!== null){info_website_field = info_websiteField.getValue();} 
			if(info_sloganField.getValue()!== null){info_slogan_field = info_sloganField.getValue();} 
			if(info_logoField.getValue()!== null){info_logo_field = info_logoField.getValue();} 
			if(info_iconField.getValue()!== null){info_icon_field = info_iconField.getValue();} 
			if(info_backgroundField.getValue()!== null){info_background_field = info_backgroundField.getValue();} 
			if(info_themeField.getValue()!== null){info_theme_field = info_themeField.getValue();} 

			Ext.Ajax.request({  
				waitMsg: 'Please wait...',
				url: 'index.php?c=c_s_info&m=get_action',
				params: {
					info_id	: info_id_field_pk, 
					info_nama	: info_nama_field, 
					info_alamat	: info_alamat_field, 
					info_notelp	: info_notelp_field, 
					info_nofax	: info_nofax_field, 
					info_email	: info_email_field, 
					info_website	: info_website_field, 
					info_slogan	: info_slogan_field, 
					info_logo	: info_logo_field, 
					info_icon	: info_icon_field, 
					info_background	: info_background_field, 
					info_theme	: info_theme_field, 
					task: post2db
				}, 
				success: function(response){             
					var result=eval(response.responseText);
					switch(result){
						case 1:
							Ext.MessageBox.alert(post2db+' OK','The S Info was '+post2db+' successfully.');
							s_info_DataStore.reload();
							s_info_saveWindow.hide();
							break;
						default:
							Ext.MessageBox.show({
							   title: 'Warning',
							   msg: 'We could\'t not '+msg+' the S Info.',
							   buttons: Ext.MessageBox.OK,
							   animEl: 'save',
							   icon: Ext.MessageBox.WARNING
							});
							break;
					}        
				},
				failure: function(response){
					var result=response.responseText;
					Ext.MessageBox.show({
						   title: 'Error',
						   msg: 'Koneksi database gagal.',
						   buttons: Ext.MessageBox.OK,
						   animEl: 'database',
						   icon: Ext.MessageBox.ERROR
					});	
				}                      
			});
			
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: 'Your Form is not valid!.',
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}
	}
 	/* End of Function */
  
  	/* Function for get PK field */
	function get_pk_id(){
		if(post2db=='UPDATE')
			return s_infoListEditorGrid.getSelectionModel().getSelected().get('info_id');
		else 
			return 0;
	}
	/* End of Function  */
	
	/* Reset form before loading */
	function s_info_reset_form(){
		info_namaField.reset();
		info_namaField.setValue(null);
		info_alamatField.reset();
		info_alamatField.setValue(null);
		info_notelpField.reset();
		info_notelpField.setValue(null);
		info_nofaxField.reset();
		info_nofaxField.setValue(null);
		info_emailField.reset();
		info_emailField.setValue(null);
		info_websiteField.reset();
		info_websiteField.setValue(null);
		info_sloganField.reset();
		info_sloganField.setValue(null);
		info_logoField.reset();
		info_logoField.setValue(null);
		info_iconField.reset();
		info_iconField.setValue(null);
		info_backgroundField.reset();
		info_backgroundField.setValue(null);
		info_themeField.reset();
		info_themeField.setValue(null);
	}
 	/* End of Function */
  
	/* setValue to EDIT */
	function s_info_set_form(){
		info_namaField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_nama'));
		info_alamatField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_alamat'));
		info_notelpField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_notelp'));
		info_nofaxField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_nofax'));
		info_emailField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_email'));
		info_websiteField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_website'));
		info_sloganField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_slogan'));
		info_logoField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_logo'));
		info_iconField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_icon'));
		info_backgroundField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_background'));
		info_themeField.setValue(s_infoListEditorGrid.getSelectionModel().getSelected().get('info_theme'));
	}
	/* End setValue to EDIT*/
  
	/* Function for Check if the form is valid */
	function is_s_info_form_valid(){
		return (true &&  true &&  true &&  true &&  true &&  true &&  true &&  true &&  true &&  true &&  true &&  true  );
	}
  	/* End of Function */
  
  	/* Function for Displaying  create Window Form */
	function display_form_window(){
		if(!s_info_saveWindow.isVisible()){
			s_info_reset_form();
			post2db='CREATE';
			msg='created';
			s_info_saveWindow.show();
		} else {
			s_info_saveWindow.toFront();
		}
	}
  	/* End of Function */
 
  	/* Function for Delete Confirm */
	function s_info_confirm_delete(){
		// only one s_info is selected here
		if(s_infoListEditorGrid.selModel.getCount() == 1){
			Ext.MessageBox.confirm('Confirmation','Apakah Anda yakin menghapus rekod ini?', s_info_delete);
		} else if(s_infoListEditorGrid.selModel.getCount() > 1){
			Ext.MessageBox.confirm('Confirmation','Apakah Anda yakin menghapus rekod-rekod ini?', s_info_delete);
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: 'You can\'t really delete something you haven\'t selected?',
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}
	}
  	/* End of Function */
  
	/* Function for Update By Confirm */
	function s_info_confirm_update(){
		/* only one record is selected here */
		if(s_infoListEditorGrid.selModel.getCount() == 1) {
			s_info_set_form();
			post2db='UPDATE';
			msg='updated';
			s_info_saveWindow.show();
		} else {
			Ext.MessageBox.show({
				title: 'Warning',
				msg: 'You can\'t really update something you haven\'t selected?',
				buttons: Ext.MessageBox.OK,
				animEl: 'save',
				icon: Ext.MessageBox.WARNING
			});
		}
	}
  	/* End of Function */
  
  	/* Function for Delete Record */
	function s_info_delete(btn){
		if(btn=='yes'){
			var selections = s_infoListEditorGrid.selModel.getSelections();
			var prez = [];
			for(i = 0; i< s_infoListEditorGrid.selModel.getCount(); i++){
				prez.push(selections[i].json.info_id);
			}
			var encoded_array = Ext.encode(prez);
			Ext.Ajax.request({ 
				waitMsg: 'Please Wait',
				url: 'index.php?c=c_s_info&m=get_action', 
				params: { task: "DELETE", ids:  encoded_array }, 
				success: function(response){
					var result=eval(response.responseText);
					switch(result){
						case 1:  // Success : simply reload
							s_info_DataStore.reload();
							break;
						default:
							Ext.MessageBox.show({
								title: 'Warning',
								msg: 'Could not delete the entire selection',
								buttons: Ext.MessageBox.OK,
								animEl: 'save',
								icon: Ext.MessageBox.WARNING
							});
							break;
					}
				},
				failure: function(response){
					var result=response.responseText;
					Ext.MessageBox.show({
					   title: 'Error',
					   msg: 'Koneksi database gagal.',
					   buttons: Ext.MessageBox.OK,
					   animEl: 'database',
					   icon: Ext.MessageBox.ERROR
					});	
				}
			});
		}  
	}
  	/* End of Function */
  
	/* Function for Retrieve DataStore */
	s_info_DataStore = new Ext.data.Store({
		id: 's_info_DataStore',
		proxy: new Ext.data.HttpProxy({
			url: 'index.php?c=c_s_info&m=get_action', 
			method: 'POST'
		}),
		baseParams:{task: "LIST", start:0, limit: pageS}, // parameter yang di $_POST ke Controller
		reader: new Ext.data.JsonReader({
			root: 'results',
			totalProperty: 'total',
			id: 'info_id'
		},[
		/* dataIndex => insert intos_info_ColumnModel, Mapping => for initiate table column */ 
			{name: 'info_id', type: 'int', mapping: 'info_id'}, 
			{name: 'info_nama', type: 'string', mapping: 'info_nama'}, 
			{name: 'info_alamat', type: 'string', mapping: 'info_alamat'}, 
			{name: 'info_notelp', type: 'string', mapping: 'info_notelp'}, 
			{name: 'info_nofax', type: 'string', mapping: 'info_nofax'}, 
			{name: 'info_email', type: 'string', mapping: 'info_email'}, 
			{name: 'info_website', type: 'string', mapping: 'info_website'}, 
			{name: 'info_slogan', type: 'string', mapping: 'info_slogan'}, 
			{name: 'info_logo', type: 'string', mapping: 'info_logo'}, 
			{name: 'info_icon', type: 'string', mapping: 'info_icon'}, 
			{name: 'info_background', type: 'string', mapping: 'info_background'}, 
			{name: 'info_theme', type: 'string', mapping: 'info_theme'} 
		]),
		sortInfo:{field: 'info_id', direction: "DESC"}
	});
	/* End of Function */
    
  	/* Function for Identify of Window Column Model */
	s_info_ColumnModel = new Ext.grid.ColumnModel(
		[{
			header: '#',
			readOnly: true,
			dataIndex: 'info_id',
			width: 40,
			renderer: function(value, cell){
				cell.css = "readonlycell"; // Mengambil Value dari Class di dalam CSS 
				return value;
				},
			hidden: false
		},
		{
			header: 'Info Nama',
			dataIndex: 'info_nama',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Alamat',
			dataIndex: 'info_alamat',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 250,
          	})
		}, 
		{
			header: 'Info Notelp',
			dataIndex: 'info_notelp',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Nofax',
			dataIndex: 'info_nofax',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Email',
			dataIndex: 'info_email',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Website',
			dataIndex: 'info_website',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Slogan',
			dataIndex: 'info_slogan',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 250,
          	})
		}, 
		{
			header: 'Info Logo',
			dataIndex: 'info_logo',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Icon',
			dataIndex: 'info_icon',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Background',
			dataIndex: 'info_background',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}, 
		{
			header: 'Info Theme',
			dataIndex: 'info_theme',
			width: 150,
			sortable: true,
			editor: new Ext.form.TextField({
				maxLength: 50,
          	})
		}	]);
	
	s_info_ColumnModel.defaultSortable= true;
	/* End of Function */
    
	/* Declare DataStore and  show datagrid list */
	s_infoListEditorGrid =  new Ext.grid.EditorGridPanel({
		id: 's_infoListEditorGrid',
		el: 'fp_s_info',
		title: 'List Of S Info',
		autoHeight: true,
		store: s_info_DataStore, // DataStore
		cm: s_info_ColumnModel, // Nama-nama Columns
		enableColLock:false,
		frame: true,
		clicksToEdit:2, // 2xClick untuk bisa meng-Edit inLine Data
		selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
		viewConfig: { forceFit:true },
	  	width: 800,
		bbar: new Ext.PagingToolbar({
			pageSize: pageS,
			store: s_info_DataStore,
			displayInfo: true
		}),
		/* Add Control on ToolBar */
		tbar: [
		{
			text: 'Add',
			tooltip: 'Add new record',
			iconCls:'icon-adds',    				// this is defined in our styles.css
			handler: display_form_window
		}, '-',{
			text: 'Edit',
			tooltip: 'Edit selected record',
			iconCls:'icon-update',
			handler: s_info_confirm_update   // Confirm before updating
		}, '-',{
			text: 'Delete',
			tooltip: 'Delete selected record',
			iconCls:'icon-delete',
			handler: s_info_confirm_delete   // Confirm before deleting
		}, '-', {
			text: 'Search',
			tooltip: 'Advanced Search',
			iconCls:'icon-search',
			handler: display_form_search_window 
		}, '-', 
			new Ext.app.SearchField({
			store: s_info_DataStore,
			params: {task: 'LIST',start: 0, limit: pageS},
			listeners:{
				specialkey: function(f,e){
					if(e.getKey() == e.ENTER){
						s_info_DataStore.baseParams={task:'LIST',start: 0, limit: pageS};
		            }
				}
			},
			width: 120
		}),'-',{
			text: 'Refresh',
			tooltip: 'Refresh datagrid',
			handler: s_info_reset_search,
			iconCls:'icon-refresh'
		},'-',{
			text: 'Export Excel',
			tooltip: 'Export to Excel(.xls) Document',
			iconCls:'icon-xls',
			handler: s_info_export_excel
		}, '-',{
			text: 'Print',
			tooltip: 'Print Document',
			iconCls:'icon-print',
			handler: s_info_print  
		}
		]
	});
	s_infoListEditorGrid.render();
	/* End of DataStore */
     
	/* Create Context Menu */
	s_info_ContextMenu = new Ext.menu.Menu({
		id: 's_info_ListEditorGridContextMenu',
		items: [
		{ 
			text: 'Edit', tooltip: 'Edit selected record', 
			iconCls:'icon-update',
			handler: s_info_editContextMenu 
		},
		{ 
			text: 'Delete', 
			tooltip: 'Delete selected record', 
			iconCls:'icon-delete',
			handler: s_info_confirm_delete 
		},
		'-',
		{ 
			text: 'Print',
			tooltip: 'Print Document',
			iconCls:'icon-print',
			handler: s_info_print 
		},
		{ 
			text: 'Export Excel', 
			tooltip: 'Export to Excel(.xls) Document',
			iconCls:'icon-xls',
			handler: s_info_export_excel 
		}
		]
	}); 
	/* End of Declaration */
	
	/* Event while selected row via context menu */
	function ons_info_ListEditGridContextMenu(grid, rowIndex, e) {
		e.stopEvent();
		var coords = e.getXY();
		s_info_ContextMenu.rowRecord = grid.store.getAt(rowIndex);
		grid.selModel.selectRow(rowIndex);
		s_info_SelectedRow=rowIndex;
		s_info_ContextMenu.showAt([coords[0], coords[1]]);
  	}
  	/* End of Function */
	
	/* function for editing row via context menu */
	function s_info_editContextMenu(){
		//s_infoListEditorGrid.startEditing(s_info_SelectedRow,1);
		s_info_confirm_update();
  	}
	/* End of Function */
  	
	s_infoListEditorGrid.addListener('rowcontextmenu', ons_info_ListEditGridContextMenu);
	s_info_DataStore.load({params: {start: 0, limit: pageS}});	// load DataStore
	s_infoListEditorGrid.on('afteredit', s_info_inline_update); // inLine Editing Record
	
	/* Identify  info_nama Field */
	info_namaField= new Ext.form.TextField({
		id: 'info_namaField',
		fieldLabel: 'Info Nama',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_alamat Field */
	info_alamatField= new Ext.form.TextField({
		id: 'info_alamatField',
		fieldLabel: 'Info Alamat',
		maxLength: 250,
		anchor: '95%'
	});
	/* Identify  info_notelp Field */
	info_notelpField= new Ext.form.TextField({
		id: 'info_notelpField',
		fieldLabel: 'Info Notelp',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_nofax Field */
	info_nofaxField= new Ext.form.TextField({
		id: 'info_nofaxField',
		fieldLabel: 'Info Nofax',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_email Field */
	info_emailField= new Ext.form.TextField({
		id: 'info_emailField',
		fieldLabel: 'Info Email',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_website Field */
	info_websiteField= new Ext.form.TextField({
		id: 'info_websiteField',
		fieldLabel: 'Info Website',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_slogan Field */
	info_sloganField= new Ext.form.TextField({
		id: 'info_sloganField',
		fieldLabel: 'Info Slogan',
		maxLength: 250,
		anchor: '95%'
	});
	/* Identify  info_logo Field */
	info_logoField= new Ext.form.TextField({
		id: 'info_logoField',
		fieldLabel: 'Info Logo',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_icon Field */
	info_iconField= new Ext.form.TextField({
		id: 'info_iconField',
		fieldLabel: 'Info Icon',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_background Field */
	info_backgroundField= new Ext.form.TextField({
		id: 'info_backgroundField',
		fieldLabel: 'Info Background',
		maxLength: 50,
		anchor: '95%'
	});
	/* Identify  info_theme Field */
	info_themeField= new Ext.form.TextField({
		id: 'info_themeField',
		fieldLabel: 'Info Theme',
		maxLength: 50,
		anchor: '95%'
	});

	
	/* Function for retrieve create Window Panel*/ 
	s_info_saveForm = new Ext.FormPanel({
		labelAlign: 'top',
		bodyStyle:'padding:5px',
		autoHeight:true,
		width: 300,        
		items:[
			{
				columnWidth:1,
				layout: 'form',
				border:false,
				items: [info_namaField, info_alamatField, info_notelpField, info_nofaxField, info_emailField, info_websiteFieldinfo_sloganFieldinfo_logoFieldinfo_iconFieldinfo_backgroundField] 
			}
			],
		buttons: [{
				text: 'Save and Close',
				handler: s_info_save
			}
			,{
				text: 'Cancel',
				handler: function(){
					s_info_saveWindow.hide();
				}
			}
		]
	});
	/* End  of Function*/
	
	/* Function for retrieve create Window Form */
	s_info_saveWindow= new Ext.Window({
		id: 's_info_saveWindow',
		title: post2db+'S Info',
		closable:true,
		closeAction: 'hide',
		autoWidth: true,
		autoHeight: true,
		x:0,
		y:0,
		plain:true,
		layout: 'fit',
		modal: true,
		renderTo: 'elwindow_s_info_save',
		items: s_info_saveForm
	});
	/* End Window */
	
	/* Function for action list search */
	function s_info_list_search(){
		// render according to a SQL date format.
		var info_id_search=null;
		var info_nama_search=null;
		var info_alamat_search=null;
		var info_notelp_search=null;
		var info_nofax_search=null;
		var info_email_search=null;
		var info_website_search=null;
		var info_slogan_search=null;
		var info_logo_search=null;
		var info_icon_search=null;
		var info_background_search=null;
		var info_theme_search=null;

		if(info_idSearchField.getValue()!==null){info_id_search=info_idSearchField.getValue();}
		if(info_namaSearchField.getValue()!==null){info_nama_search=info_namaSearchField.getValue();}
		if(info_alamatSearchField.getValue()!==null){info_alamat_search=info_alamatSearchField.getValue();}
		if(info_notelpSearchField.getValue()!==null){info_notelp_search=info_notelpSearchField.getValue();}
		if(info_nofaxSearchField.getValue()!==null){info_nofax_search=info_nofaxSearchField.getValue();}
		if(info_emailSearchField.getValue()!==null){info_email_search=info_emailSearchField.getValue();}
		if(info_websiteSearchField.getValue()!==null){info_website_search=info_websiteSearchField.getValue();}
		if(info_sloganSearchField.getValue()!==null){info_slogan_search=info_sloganSearchField.getValue();}
		if(info_logoSearchField.getValue()!==null){info_logo_search=info_logoSearchField.getValue();}
		if(info_iconSearchField.getValue()!==null){info_icon_search=info_iconSearchField.getValue();}
		if(info_backgroundSearchField.getValue()!==null){info_background_search=info_backgroundSearchField.getValue();}
		if(info_themeSearchField.getValue()!==null){info_theme_search=info_themeSearchField.getValue();}
		// change the store parameters
		s_info_DataStore.baseParams = {
			task: 'SEARCH',
			//variable here
			info_id	:	info_id_search, 
			info_nama	:	info_nama_search, 
			info_alamat	:	info_alamat_search, 
			info_notelp	:	info_notelp_search, 
			info_nofax	:	info_nofax_search, 
			info_email	:	info_email_search, 
			info_website	:	info_website_search, 
			info_slogan	:	info_slogan_search, 
			info_logo	:	info_logo_search, 
			info_icon	:	info_icon_search, 
			info_background	:	info_background_search, 
			info_theme	:	info_theme_search 
		};
		// Cause the datastore to do another query : 
		s_info_DataStore.reload({params: {start: 0, limit: pageS}});
	}
		
	/* Function for reset search result */
	function s_info_reset_search(){
		// reset the store parameters
		s_info_DataStore.baseParams = { task: 'LIST', start:0, limit:pageS };
		// Cause the datastore to do another query : 
		s_info_DataStore.reload({params: {start: 0, limit: pageS}});
		s_info_searchWindow.close();
	};
	/* End of Fuction */
	
	/* Field for search */
	/* Identify  info_id Search Field */
	info_idSearchField= new Ext.form.NumberField({
		id: 'info_idSearchField',
		fieldLabel: 'Info Id',
		allowNegatife : false,
		blankText: '0',
		allowDecimals: false,
		anchor: '95%',
		maskRe: /([0-9]+)$/
	
	});
	/* Identify  info_nama Search Field */
	info_namaSearchField= new Ext.form.TextField({
		id: 'info_namaSearchField',
		fieldLabel: 'Info Nama',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_alamat Search Field */
	info_alamatSearchField= new Ext.form.TextField({
		id: 'info_alamatSearchField',
		fieldLabel: 'Info Alamat',
		maxLength: 250,
		anchor: '95%'
	
	});
	/* Identify  info_notelp Search Field */
	info_notelpSearchField= new Ext.form.TextField({
		id: 'info_notelpSearchField',
		fieldLabel: 'Info Notelp',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_nofax Search Field */
	info_nofaxSearchField= new Ext.form.TextField({
		id: 'info_nofaxSearchField',
		fieldLabel: 'Info Nofax',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_email Search Field */
	info_emailSearchField= new Ext.form.TextField({
		id: 'info_emailSearchField',
		fieldLabel: 'Info Email',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_website Search Field */
	info_websiteSearchField= new Ext.form.TextField({
		id: 'info_websiteSearchField',
		fieldLabel: 'Info Website',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_slogan Search Field */
	info_sloganSearchField= new Ext.form.TextField({
		id: 'info_sloganSearchField',
		fieldLabel: 'Info Slogan',
		maxLength: 250,
		anchor: '95%'
	
	});
	/* Identify  info_logo Search Field */
	info_logoSearchField= new Ext.form.TextField({
		id: 'info_logoSearchField',
		fieldLabel: 'Info Logo',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_icon Search Field */
	info_iconSearchField= new Ext.form.TextField({
		id: 'info_iconSearchField',
		fieldLabel: 'Info Icon',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_background Search Field */
	info_backgroundSearchField= new Ext.form.TextField({
		id: 'info_backgroundSearchField',
		fieldLabel: 'Info Background',
		maxLength: 50,
		anchor: '95%'
	
	});
	/* Identify  info_theme Search Field */
	info_themeSearchField= new Ext.form.TextField({
		id: 'info_themeSearchField',
		fieldLabel: 'Info Theme',
		maxLength: 50,
		anchor: '95%'
	
	});
    
	/* Function for retrieve search Form Panel */
	s_info_searchForm = new Ext.FormPanel({
		labelAlign: 'top',
		bodyStyle:'padding:5px',
		autoHeight:true,
		width: 300,        
		items: [{
			layout:'column',
			border:false,
			items:[
			{
				columnWidth:1,
				layout: 'form',
				border:false,
				items: [info_idSearchField, info_namaSearchField, info_alamatSearchField, info_notelpSearchField, info_nofaxSearchField, info_emailSearchField, info_websiteSearchFieldinfo_sloganSearchFieldinfo_logoSearchFieldinfo_iconSearchFieldinfo_backgroundSearchField] 
			}
			]
		}]
		,
		buttons: [{
				text: 'Search',
				handler: s_info_list_search
			},{
				text: 'Close',
				handler: function(){
					s_info_searchWindow.hide();
				}
			}
		]
	});
    /* End of Function */ 
	 
	/* Function for retrieve search Window Form, used for andvaced search */
	s_info_searchWindow = new Ext.Window({
		title: 's_info Search',
		closable:true,
		closeAction: 'hide',
		autoWidth: true,
		autoHeight: true,
		plain:true,
		layout: 'fit',
		x: 0,
		y: 0,
		modal: true,
		renderTo: 'elwindow_s_info_search',
		items: s_info_searchForm
	});
    /* End of Function */ 
	 
  	/* Function for Displaying  Search Window Form */
	function display_form_search_window(){
		if(!s_info_searchWindow.isVisible()){
			s_info_searchWindow.show();
		} else {
			s_info_searchWindow.toFront();
		}
	}
  	/* End Function */
	
	/* Function for print List Grid */
	function s_info_print(){
		var searchquery = "";
		var info_id_print=null;
		var info_nama_print=null;
		var info_alamat_print=null;
		var info_notelp_print=null;
		var info_nofax_print=null;
		var info_email_print=null;
		var info_website_print=null;
		var info_slogan_print=null;
		var info_logo_print=null;
		var info_icon_print=null;
		var info_background_print=null;
		var info_theme_print=null;
		var win;              
		// check if we do have some search data...
		if(s_info_DataStore.baseParams.query!==null){searchquery = s_info_DataStore.baseParams.query;}
		if(s_info_DataStore.baseParams.info_id!==null){info_id_print = s_info_DataStore.baseParams.info_id;}
		if(s_info_DataStore.baseParams.info_nama!==null){info_nama_print = s_info_DataStore.baseParams.info_nama;}
		if(s_info_DataStore.baseParams.info_alamat!==null){info_alamat_print = s_info_DataStore.baseParams.info_alamat;}
		if(s_info_DataStore.baseParams.info_notelp!==null){info_notelp_print = s_info_DataStore.baseParams.info_notelp;}
		if(s_info_DataStore.baseParams.info_nofax!==null){info_nofax_print = s_info_DataStore.baseParams.info_nofax;}
		if(s_info_DataStore.baseParams.info_email!==null){info_email_print = s_info_DataStore.baseParams.info_email;}
		if(s_info_DataStore.baseParams.info_website!==null){info_website_print = s_info_DataStore.baseParams.info_website;}
		if(s_info_DataStore.baseParams.info_slogan!==null){info_slogan_print = s_info_DataStore.baseParams.info_slogan;}
		if(s_info_DataStore.baseParams.info_logo!==null){info_logo_print = s_info_DataStore.baseParams.info_logo;}
		if(s_info_DataStore.baseParams.info_icon!==null){info_icon_print = s_info_DataStore.baseParams.info_icon;}
		if(s_info_DataStore.baseParams.info_background!==null){info_background_print = s_info_DataStore.baseParams.info_background;}
		if(s_info_DataStore.baseParams.info_theme!==null){info_theme_print = s_info_DataStore.baseParams.info_theme;}

		Ext.Ajax.request({   
		waitMsg: 'Please Wait...',
		url: 'index.php?c=c_s_info&m=get_action',
		params: {
			task: "PRINT",
		  	query: searchquery,                    		// if we are doing a quicksearch, use this
			//if we are doing advanced search, use this
			info_id : info_id_print,
			info_nama : info_nama_print,
			info_alamat : info_alamat_print,
			info_notelp : info_notelp_print,
			info_nofax : info_nofax_print,
			info_email : info_email_print,
			info_website : info_website_print,
			info_slogan : info_slogan_print,
			info_logo : info_logo_print,
			info_icon : info_icon_print,
			info_background : info_background_print,
			info_theme : info_theme_print,
		  	currentlisting: s_info_DataStore.baseParams.task // this tells us if we are searching or not
		}, 
		success: function(response){              
		  	var result=eval(response.responseText);
		  	switch(result){
		  	case 1:
				win = window.open('./print/s_info_printlist.html','s_infolist','height=400,width=600,resizable=1,scrollbars=1, menubar=1');
				win.print();
				break;
		  	default:
				Ext.MessageBox.show({
					title: 'Warning',
					msg: 'Unable to print the grid!',
					buttons: Ext.MessageBox.OK,
					animEl: 'save',
					icon: Ext.MessageBox.WARNING
				});
				break;
		  	}  
		},
		failure: function(response){
		  	var result=response.responseText;
			Ext.MessageBox.show({
			   title: 'Error',
			   msg: 'Koneksi database gagal.',
			   buttons: Ext.MessageBox.OK,
			   animEl: 'database',
			   icon: Ext.MessageBox.ERROR
			});		
		} 	                     
		});
	}
	/* Enf Function */
	
	/* Function for print Export to Excel Grid */
	function s_info_export_excel(){
		var searchquery = "";
		var info_id_2excel=null;
		var info_nama_2excel=null;
		var info_alamat_2excel=null;
		var info_notelp_2excel=null;
		var info_nofax_2excel=null;
		var info_email_2excel=null;
		var info_website_2excel=null;
		var info_slogan_2excel=null;
		var info_logo_2excel=null;
		var info_icon_2excel=null;
		var info_background_2excel=null;
		var info_theme_2excel=null;
		var win;              
		// check if we do have some search data...
		if(s_info_DataStore.baseParams.query!==null){searchquery = s_info_DataStore.baseParams.query;}
		if(s_info_DataStore.baseParams.info_id!==null){info_id_2excel = s_info_DataStore.baseParams.info_id;}
		if(s_info_DataStore.baseParams.info_nama!==null){info_nama_2excel = s_info_DataStore.baseParams.info_nama;}
		if(s_info_DataStore.baseParams.info_alamat!==null){info_alamat_2excel = s_info_DataStore.baseParams.info_alamat;}
		if(s_info_DataStore.baseParams.info_notelp!==null){info_notelp_2excel = s_info_DataStore.baseParams.info_notelp;}
		if(s_info_DataStore.baseParams.info_nofax!==null){info_nofax_2excel = s_info_DataStore.baseParams.info_nofax;}
		if(s_info_DataStore.baseParams.info_email!==null){info_email_2excel = s_info_DataStore.baseParams.info_email;}
		if(s_info_DataStore.baseParams.info_website!==null){info_website_2excel = s_info_DataStore.baseParams.info_website;}
		if(s_info_DataStore.baseParams.info_slogan!==null){info_slogan_2excel = s_info_DataStore.baseParams.info_slogan;}
		if(s_info_DataStore.baseParams.info_logo!==null){info_logo_2excel = s_info_DataStore.baseParams.info_logo;}
		if(s_info_DataStore.baseParams.info_icon!==null){info_icon_2excel = s_info_DataStore.baseParams.info_icon;}
		if(s_info_DataStore.baseParams.info_background!==null){info_background_2excel = s_info_DataStore.baseParams.info_background;}
		if(s_info_DataStore.baseParams.info_theme!==null){info_theme_2excel = s_info_DataStore.baseParams.info_theme;}

		Ext.Ajax.request({   
		waitMsg: 'Please Wait...',
		url: 'index.php?c=c_s_info&m=get_action',
		params: {
			task: "EXCEL",
		  	query: searchquery,                    		// if we are doing a quicksearch, use this
			//if we are doing advanced search, use this
			info_id : info_id_2excel,
			info_nama : info_nama_2excel,
			info_alamat : info_alamat_2excel,
			info_notelp : info_notelp_2excel,
			info_nofax : info_nofax_2excel,
			info_email : info_email_2excel,
			info_website : info_website_2excel,
			info_slogan : info_slogan_2excel,
			info_logo : info_logo_2excel,
			info_icon : info_icon_2excel,
			info_background : info_background_2excel,
			info_theme : info_theme_2excel,
		  	currentlisting: s_info_DataStore.baseParams.task // this tells us if we are searching or not
		},
		success: function(response){              
		  	var result=eval(response.responseText);
		  	switch(result){
		  	case 1:
				win = window.location=('./export2excel.php');
				break;
		  	default:
				Ext.MessageBox.show({
					title: 'Warning',
					msg: 'Unable to convert excel the grid!',
					buttons: Ext.MessageBox.OK,
					animEl: 'save',
					icon: Ext.MessageBox.WARNING
				});
				break;
		  	}  
		},
		failure: function(response){
		  	var result=response.responseText;
			Ext.MessageBox.show({
			   title: 'Error',
			   msg: 'Koneksi database gagal.',
			   buttons: Ext.MessageBox.OK,
			   animEl: 'database',
			   icon: Ext.MessageBox.ERROR
			});    
		} 	                     
		});
	}
	/*End of Function */
	
});
	</script>
<body>
<div>
	<div class="col">
        <div id="fp_s_info"></div>
		<div id="elwindow_s_info_save"></div>
        <div id="elwindow_s_info_search"></div>
    </div>
</div>
</body>